#ifndef _ICMPPACKET_H_
#define _ICMPPACKET_H_

#include "types.hpp"
#include "net/IPAddress.hpp"
#include "net/ICMPPacketImpl.hpp"

NET_NAMESPACE_BEGIN

class CICMPPacket
{
public:
	CICMPPacket(CIPAddress::Family family, int dataSize = 48);
	~CICMPPacket();

	const UInt8* packet();
	int packetSize() const;
	UInt16 sequence() const;
	void setDataSize(int dataSize);
	int getDataSize() const;
	int maxPacketSize() const;

	struct timeval time(UInt8* buffer = 0, int length = 0) const;
	bool validReplyID(UInt8* buffer, int length) const;
	std::string errorDescription(UInt8* buffer, int length);
	std::string typeDescription(int typeId);

private:
	CICMPPacketImpl* m_pImpl;
};


NET_NAMESPACE_END

#endif
